package com.settlement.system.service;

import com.settlement.system.common.exception.ServiceException;
import com.settlement.system.model.entity.common.TblUnificationBillDetail;

import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * 统一账单明细 服务类
 *
 * @author Ximi
 * @since 2020-07-01
 */

public interface ITblUnificationBillDetailService extends IBaseService {

    /**
     * 获取合计
     *
     * @param params 请求参数
     * @return
     * @throws ServiceException
     */
    public TblUnificationBillDetail getFoot(Map<String, Object> params) throws ServiceException;

    /**
     * 获取爱库存已经推送了的数量
     *
     * @param actionId 活动ID
     * @param billType 账单类型(收款,尾款)
     * @return 已经推送的数量
     * @throws ServiceException
     */
    public Integer getAkcPushedCount(String actionId, String billType) throws ServiceException;

    /**
     * 更新爱库存的日期
     *
     * @param actionId 活动ID
     * @param billType 账单类型
     * @param date     日期
     * @return 更新的数量
     * @throws ServiceException
     */
    public Integer updateAkcDate(String actionId, String billType, Date date) throws ServiceException;

    String billSummary(Map<String, Object> params) throws ServiceException;

    /**
     * 推送NC
     *
     * @param params
     * @return
     * @throws ServiceException
     */
    //public String pushNc(Map<String, Object> params) throws ServiceException;

    /**
     * 更新匹配
     *
     * @param list
     * @throws ServiceException
     */
    public void updateMatch(List<TblUnificationBillDetail> list) throws ServiceException;

    /**
     * 刷新未匹配的单据
     *
     * @param params
     * @return
     * @throws ServiceException
     */
    public Integer refreshNoMatch(Map<String, Object> params) throws ServiceException;

    Integer selectOneByBatchNumber(long batchNumber) throws ServiceException;

    Long selectTheNewestBatchNumber() throws ServiceException;

    /**
     * refreshNoMatchByActionIdOfAkc
     * @param actionId
     * @return
     * @throws ServiceException
     */
    public Integer refreshNoMatchByActionIdOfAkc(String actionId) throws ServiceException;

    /**
     * 刷新爱库存日期
     *
     * @param params
     * @return
     * @throws ServiceException
     */
    public Integer refreshAkcDate(Map<String, Object> params) throws ServiceException;

    /**
     * 刷新
     *
     * @param params
     * @throws ServiceException
     * @return
     */
    public String refresh(Map<String, Object> params) throws ServiceException;

    /**
     * 删除数据 通过统一账单ID
     *
     * @param minUnificationBillId
     * @param maxUnificationBillId
     */
    public void deleteByUnificationBillIds(String minUnificationBillId, String maxUnificationBillId);


    /**
     *  校验单据是含有锁帐前的数据
     * @param params
     * @return
     * @throws ServiceException
     */
    int validateCloseDate(Map<String,Object> params) throws ServiceException;

    int selectCountByBatchNumberAndCpnStatus(Map<String,Object> params) throws ServiceException;

    int selectCountByBatchNumberAndNotCreateUser(Map<String,Object> params) throws ServiceException;

    int selectCountByBatchNumberAndNotCmStatus(Map<String,Object> params) throws ServiceException;

    /**
     * 根据批次号汇总外部订单号和店铺
     * @param params
     * @return
     * @throws ServiceException
     */
    List<TblUnificationBillDetail> getDeleteDate(Map<String, Object> params) throws ServiceException;

    /**
     * 删除批次数据
     * @param params
     * @throws ServiceException
     * @return
     */
    boolean deleteByBatchNumber(Map<String, Object> params) throws ServiceException;

    /**
     * 锁账判断
     * @param params
     * @return
     * @throws ServiceException
     */
    public String checkIfCloseAccount(Map<String, Object> params) throws ServiceException;

    /**
     * 爱库存删数据
     * @param params
     * @throws ServiceException
     */
    public void deleteAkcDataByParams(Map<String,Object> params) throws ServiceException;

    int updateOriginBillProjectBySerialNoList(List<String> serialNoList) throws ServiceException;

    void refreshShareOrNot(Map<String,Object> params);

    void refreshBeforeOrAfterTicket(Map<String,Object> params);

    TblUnificationBillDetail selectOneByParam(Map<String, Object> params) throws ServiceException;
}

